package ControllerLayer;
import DomainLayer.*;
 

public class CustomerController{

    private CustomerCollection customers;
    private static CustomerController instance;
    
    private CustomerController()
    {
        customers = CustomerCollection.getInstance();
    }
    
    //@return creates only one object of class CustomerController.
    public static CustomerController getInstance()
    {
        if(instance==null)
        {
            instance=new CustomerController();
        }
        return instance;
    }

    
    public Customer searchCustomer(int id){
        return customers.searchCustomer(id);
    }
    
    public void createCustomer(int id, String name, String address, String city){
       customers.addCustomer(id,name,address,city); 
    }
    
    
    public String printCustomer(int id)
    {
        return searchCustomer(id).toString();
    }
    
    public void deleteCustomer(int id) 
    {
        customers.deleteCustomer(id);
        
    }
    
    
    public String printAllCustomers()
    {
        return customers.printAllCustomers();
    }
}